package com.sc.adminspringboot.controller;

import com.sc.adminspringboot.service.IPostCollectionsService;
import com.sc.adminspringboot.utils.ResponseMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户帖子收藏关联表 前端控制器
 * </p>
 *
 * @author 万超凡
 * @since 2025-09-20 10:36:46
 */
@RestController
@RequestMapping("/postCollections")
public class PostCollectionsController {
    //TODO 帖子收藏相关接口

    @Autowired
    IPostCollectionsService postCollectionsService;

    @RequestMapping("delete")
    ResponseMsg delete(@RequestParam Integer id) {
        if (id == null) {
            return ResponseMsg.getInstance(ResponseMsg.PARAM_ERROR,"收藏对应的post id不能为空");
        }

        return ResponseMsg.getInstance(ResponseMsg.SUCCESS,"删除成功",postCollectionsService.removeById(id));
    }
}
